package com.t.testsql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class Sqldatabase extends SQLiteOpenHelper {

//     db.execSQL("CREATE TABLE " + 表名 + " ("
//            + 列名 + " INTEGER PRIMARY KEY AUTOINCREMENT,"
//            + 列名+ " TEXT,"
//            + 列名 + " TEXT,"
//            + 列名 + " TEXT,"
//            + 列名 + " TEXT,"
//            + 列名+ " INTEGER,"
//            + 列名+ " LONG,"
//            + 列名+ " TEXT,"
//            + 列名+ " TEXT,"
//            + 列名+ " INTEGER,"
//            + 列名+ " TEXT"
//            + ");");


    // 继承的时候会直接出现，4个参数的方法，都去掉只留下一个参数的即可。
    public Sqldatabase(Context context) {
        // 修改父类重写的方法
        super(context, "test.db", null, 1);
    }

    public final static String TABLE_NAME = "my_table";
    public final static String COULUMN_ID = "id";
    public static String COULUMN_NAME = "name";
    public static String COULUMN_AGE = "age";
    public final static String COULUMN_PHONE = "phone";

    @Override
    public void onCreate(SQLiteDatabase db) {

        db.execSQL("CREATE TABLE " + "my_table" + " ("
                + COULUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
                + COULUMN_NAME + " TEXT,"
                + COULUMN_AGE + " TEXT,"
                + COULUMN_PHONE + " TEXT"
                + ");");

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
